<template>
  <div class="dataInTime">
    <div
      v-for="(item, index) in inTimeInfo"
      :key="index"
      class="dataInTime-item"
    >
      <div class="dataInTime-item-data">{{ item.value }}</div>
      <div class="dataInTime-item-title">{{ item.name }}({{ item.unit }})</div>
    </div>
    <div v-if="!inTimeInfo.length" style="padding-top: 30px;display: flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;" >
							<img :src="imgLoader" style="width: 100px;height: 100px;"></img>
							<span style="display: block;height: 40px;height: 40px;">暂无数据</span>
		</div>
  </div>
</template>
<script setup>
import { ref, getCurrentInstance, onMounted } from "vue";
import imgLoader from "@/assets/images/nodata.png";
let { proxy } = getCurrentInstance();
const props = defineProps({
  address: {
    type: Object,
    default: () => {},
  },
});
const inTimeInfo = ref([

]);
const getData = () => {
  proxy
    ._http({
      url: "/api/equipment/rundata",
      type: "post",
      isBody: true,
      isLoading: true,
      data: {
        address: props.address,
      },
    })
    .then((res) => {
      console.log(567, res);
      inTimeInfo.value = res || [];
    })
    .catch((err) => {

    });
};
onMounted(() => {
  getData();
});
</script>
<style lang="scss">
.dataInTime {
  display: flex;
  flex-wrap: wrap;
  gap: 2%;
  &-item {
    display: flex;
    padding: 28px 0;
    margin-bottom: 18px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 23%;
    background-color: #f2f9ff;
    border-radius: 4px;
    &-data {
      font-size: 32px;
      color: #555555;
      font-weight: bold;
      margin-bottom: 18px;
    }
    &-title {
      color: #999;
      font-size: 14px;
    }
  }
}
</style>
